<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GdkDisplayManager</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK 3 参考手册">
<link rel="up" href="reference.html" title="API参考">
<link rel="prev" href="gdk3-General.html" title="General">
<link rel="next" href="gdk3-GdkDisplay.html" title="GdkDisplay">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk3-General.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK 3 参考手册</th>
<td><a accesskey="n" href="gdk3-GdkDisplay.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk3-GdkDisplayManager.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk3-GdkDisplayManager.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk3-GdkDisplayManager"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk3-GdkDisplayManager.top_of_page"></a>GdkDisplayManager</span></h2>
<p>GdkDisplayManager — Maintains a list of all open GdkDisplays</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk3-GdkDisplayManager.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

                    <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager">GdkDisplayManager</a>;
<a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="returnvalue">GdkDisplayManager</span></a> * <a class="link" href="gdk3-GdkDisplayManager.html#gdk-display-manager-get" title="gdk_display_manager_get ()">gdk_display_manager_get</a>             (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="returnvalue">GdkDisplay</span></a> *        <a class="link" href="gdk3-GdkDisplayManager.html#gdk-display-manager-get-default-display" title="gdk_display_manager_get_default_display ()">gdk_display_manager_get_default_display</a>
                                                        (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk3-GdkDisplayManager.html#gdk-display-manager-set-default-display" title="gdk_display_manager_set_default_display ()">gdk_display_manager_set_default_display</a>
                                                        (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a> *display</code></em>);
<a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="returnvalue">GSList</span></a> *            <a class="link" href="gdk3-GdkDisplayManager.html#gdk-display-manager-list-displays" title="gdk_display_manager_list_displays ()">gdk_display_manager_list_displays</a>   (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>);
<a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="returnvalue">GdkDisplay</span></a> *        <a class="link" href="gdk3-GdkDisplayManager.html#gdk-display-manager-open-display" title="gdk_display_manager_open_display ()">gdk_display_manager_open_display</a>    (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk3-GdkDisplayManager.description"></a><h2>Description</h2>
<p>
The purpose of the <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> singleton object is to offer
notification when displays appear or disappear or the default display
changes.
</p>
<p>
You can use <a class="link" href="gdk3-GdkDisplayManager.html#gdk-display-manager-get" title="gdk_display_manager_get ()"><code class="function">gdk_display_manager_get()</code></a> to obtain the GdkDisplayManager
singleton, but that should be rarely necessary. Typically, initializing
GTK+ opens a display that you can work with without ever accessing the
GdkDisplayManager.
</p>
<p>
The GDK library can be built with support for multiple backends.
The GdkDisplayManager object determines which backend is used
at runtime.
</p>
<p>
When writing backend-specific code that is supposed to work with
multiple GDK backends, you have to consider both compile time and
runtime. At compile time, use the <a class="link" href="gdk3-General.html#GDK-WINDOWING-X11:CAPS" title="GDK_WINDOWING_X11"><span class="type">GDK_WINDOWING_X11</span></a>, <a class="link" href="gdk3-General.html#GDK-WINDOWING-WIN32:CAPS" title="GDK_WINDOWING_WIN32"><span class="type">GDK_WINDOWING_WIN32</span></a>
macros, etc. to find out which backends are present in the GDK library
you are building your application against. At runtime, use type-check
macros like <code class="function">GDK_IS_X11_DISPLAY()</code> to find out which backend is in use:
</p>
<p>
</p>
<div class="example">
<a name="backend-specific"></a><p class="title"><b>Example 2. Backend-specific code</b></p>
<div class="example-contents"><pre class="programlisting">
#ifdef GDK_WINDOWING_X11
  if (GDK_IS_X11_DISPLAY (display))
    {
      /* make X11-specific calls here */
    }
  else
#endif
#ifdef GDK_WINDOWING_QUARTZ
  if (GDK_IS_QUARTZ_DISPLAY (display))
    {
      /* make Quartz-specific calls here */
    }
  else
#endif
  g_error ("Unsupported GDK backend");
</pre></div>
</div>
<p><br class="example-break">
</p>
</div>
<div class="refsect1">
<a name="gdk3-GdkDisplayManager.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkDisplayManager"></a><h3>GdkDisplayManager</h3>
<pre class="programlisting">typedef struct {
  GObject parent_instance;
} GdkDisplayManager;
</pre>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-display-manager-get"></a><h3>gdk_display_manager_get ()</h3>
<pre class="programlisting"><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="returnvalue">GdkDisplayManager</span></a> * gdk_display_manager_get             (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Gets the singleton <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> object.
</p>
<p>
When called for the first time, this function consults the
<code class="envar">GDK_BACKEND</code> environment variable to find out which
of the supported GDK backends to use (in case GDK has been compiled
with multiple backends).
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>The global <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> singleton;
<a class="link" href="gdk3-General.html#gdk-parse-args" title="gdk_parse_args ()"><code class="function">gdk_parse_args()</code></a>, <a class="link" href="gdk3-General.html#gdk-init" title="gdk_init ()"><code class="function">gdk_init()</code></a>, or <a class="link" href="gdk3-General.html#gdk-init-check" title="gdk_init_check ()"><code class="function">gdk_init_check()</code></a> must have
been called first. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-display-manager-get-default-display"></a><h3>gdk_display_manager_get_default_display ()</h3>
<pre class="programlisting"><a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="returnvalue">GdkDisplay</span></a> *        gdk_display_manager_get_default_display
                                                        (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>);</pre>
<p>
得到默认的<a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a>。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>manager</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
if there is no default display. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-display-manager-set-default-display"></a><h3>gdk_display_manager_set_default_display ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_display_manager_set_default_display
                                                        (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a> *display</code></em>);</pre>
<p>
设置<em class="parameter"><code>display</code></em>作为默认的显示(display)。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>manager</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>display</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-display-manager-list-displays"></a><h3>gdk_display_manager_list_displays ()</h3>
<pre class="programlisting"><a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="returnvalue">GSList</span></a> *            gdk_display_manager_list_displays   (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>);</pre>
<p>
列出所有当前打开的显示(displays)。
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>manager</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a newly
allocated <a href="../glib/glib-Singly-Linked-Lists.html#GSList"><span class="type">GSList</span></a> of <a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a> objects. Free with <a href="../glib/glib-Singly-Linked-Lists.html#g-slist-free"><code class="function">g_slist_free()</code></a>
when you are done with it. <span class="annotation">[<acronym title="Free data container after the code is done."><span class="acronym">transfer container</span></acronym>][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> GdkDisplay]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="gdk-display-manager-open-display"></a><h3>gdk_display_manager_open_display ()</h3>
<pre class="programlisting"><a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="returnvalue">GdkDisplay</span></a> *        gdk_display_manager_open_display    (<em class="parameter"><code><a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a> *manager</code></em>,
                                                         <em class="parameter"><code>const <a href="../glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>);</pre>
<p>
Opens a display.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>manager</code></em> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplayManager.html#GdkDisplayManager" title="GdkDisplayManager"><span class="type">GdkDisplayManager</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td>
<td>the name of the display to open</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a <a class="link" href="gdk3-GdkDisplay.html#GdkDisplay" title="GdkDisplay"><span class="type">GdkDisplay</span></a>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>
if the display could not be opened. <span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 3.0</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>